package org.mx.test.entity;

import org.mx.dal.entity.BaseDictEntity;

import javax.persistence.*;
import java.util.Set;

@SuppressWarnings("javadoc")
@Entity
@Table(name = "T_USER")
public class UserEntity extends BaseDictEntity {
	private static final long serialVersionUID = 3844798016782123679L;
	@ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "T_USER_ROLE",
            joinColumns = @JoinColumn(name = "USER_ID", referencedColumnName = "ID"),
            inverseJoinColumns = @JoinColumn(name = "ROLE_ID", referencedColumnName = "ID"))
    private Set<RoleEntity> roles;

    public Set<RoleEntity> getRoles() {
        return roles;
    }

    public void setRoles(Set<RoleEntity> roles) {
        this.roles = roles;
    }
}
